<body>
<script type="text/javascript">
    $(document).ready(
        function(){
            $("#update_book").validate();
        }
    )
</script>

</script>
<script type="text/javascript">
    function logOut(){
        var result = confirm("Bạn có chắc chắn muốn đăng xuất không?");
        confi
        return result;
    } 
</script>

<div class="topbar">
	<div class="content">
        <div class="right">
        	<!--BEGIN: Topbar Right-->
            
            
            <div class="widget-logout">
            	<a href="logout.php" title="" onclick=" return logOut();">
                	<span>Thoát</span>
                </a>
            </div>
            <!--END Topbar Right-->
        </div>
        <div class="clear"></div>
    </div>
</div>
<div class="header">
	<div class="content">
        <div class="right">
        	<!--BEGIN: Header Right-->
            <div class="widget-menu tab">
            	<ul>
                	<li class="first">
                    	<a href="#" class="active" title="">
                        	<span>
                            	<img src="file:///G:/Download/GEATE/icon_16x16.png" alt="" />
                                Trang chủ
                            </span>
                        </a>
                    </li>
                    <li>
                    	<a href="#" title="">
                        	<span>
                            	<img src="file:///G:/Download/GEATE/icon_16x16.png" alt="" />
                                Hỗ trợ
                            </span>
                        </a>
                    </li>
                    <li>
                    	<a href="#" title="">
                        	<span>
                            	<img src="file:///G:/Download/GEATE/icon_16x16.png" alt="" />
                                Mã nguồn
                            </span>
                        </a>
                    </li>
                    <div class="clear"></div>
                </ul>
            </div>
            <!--END Header Right-->
        </div>
        <div class="clear"></div>
    </div>
</div>
<div class="menu">
	<div class="content">
    	<!--BEGIN: Menu-->
        <div class="widget-menu list">
        	<ul id="nav">
            	<li>
                	<a href="index.php" title="">Quản lý đơn hàng</a>
                </li>
                <li>
                	<a href="books.php" class="active" title="">Quản lý sách</a>
                    <ul>
                        <li>
                            <a href="addbook.php" title="">Thêm sách</a>
                        </li>
                    </ul>
                </li>
                <li>
                	<a href="accounts.php" title="">Quản lý tài khoản</a>
                    <ul>
                        <li>
                            <a href="addmember.php" title="">Thêm tài khoản</a>
                        </li>
                    </ul>
                </li>
                <div class="clear"></div>
            </ul>
        </div>
        <!--END Menu-->
    </div>
</div>
<div class="main">
	<div class="content">
    	<div class="toolbar">
        	<!--BEGIN: Message-->
            <?php echo "<div class='" . $class . "'>" . $message . "</div>"?>
            <!--END Message-->
        	<!--BEGIN: Toolbar-->
            <div class="widget-toolbar">
            	<h2 class="list">Sửa thông tin sách</h2>
                <ul>
                	<li class="first">
                        <input type="submit" name="submit" value="Cập nhật" class="save" form="update_book" /> 
                    </li>
                    <li>
                    	<input type="reset" name="reset" value="Nhập lại" class="reset" form="update_book" />
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="clear"></div>
            </div>
            <!--END Toolbar-->
        </div>
        <div class="body">
        	<!--BEGIN: Body-->   
         <form action="editbook.php?book_id=<?=$bookId?>" method="post" name="updatebook" id="update_book" enctype="multipart/form-data">
            <div class="module-form">
            	<ul>
                    <li>
                    	<label>Tên sách<span>(*)</span>:</label>
                        <input type="text" name="bookname" value="<?php echo $book["Name"]?>" class="required" minlength="4"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Mã sách<span>(*)</span>:</label>
                        <input type="text" name="bookcode" value="<?php echo $book["Code"]?>" class="required"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Tác giả<span>(*)</span>:</label>
                        <input type="text" name="author" value="<?php echo $book["Author"]?>" class="required"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Nhà xuất bản<span>(*)</span>:</label>
                        <input type="text" name="publisher" value="<?php echo $book["Publisher"]?>" class="required"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Mã loại sách<span>(*)</span>:</label>
                        <input type="text" name="cateId" value="<?php echo $book["CateId"]?>" class="required"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Trạng thái sách<span>(*)</span>:</label>
                        <input type="text" name="status" value="<?php echo $book["Status"]?>"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Chi tiết<span>(*)</span>:</label>
                        <input type="text" name="detail" value="<?php echo $book["Detail"]?>" class="required"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Giá bán<span>(*)</span>:</label>
                        <input type="text" name="price" value="<?php echo $book["Price"]?>" class="required"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Giá sale off:</label>
                        <input type="text" name="saleOffPrice" value="<?php echo $book["SaleOffPrice"]?>"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>ImageUrl:</label>
                        <input type="text" name="imageUrl" value="<?php echo $book["ImageUrl"]?>"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                    <?php 
                    if($book["ImageUrl"] == "")
                    {
                        $class = 'required';
                    }
                    else
                    {
                        $class = '';
                    }
                    
                    ?>
                        <label>Image<span>(*)</span>:</label>
                        <input type="file" name="image" class="<?php echo $class ?>"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Mô tả:</label>
                        <textarea name="description" rows="5" cols="30"><?php echo $book["Description"]?></textarea>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Sách tiêu biểu:</label>
                        <?php 
                            $featuredBook = '';
                            if($book["FeaturedBook"] == "1")
                            {
                                $featuredBook = 'checked';
                            }
                            else if($book["FeaturedBook"] == "0")
                            {
                                $featuredBook = '';
                            }
                        ?>
                        <input type="checkbox" name="featuredBook" <?php echo $featuredBook ?> value="featuredBook" />
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <label>Quà tặng đặc biệt:</label>
                        <?php 
                            $specialGift = '';
                            if($book["SpecialGift"] == "1")
                            {
                                $specialGift = 'checked';
                            }
                            else if($book["SpecialGift"] == "0")
                            {
                                $specialGift = '';
                            }
                        ?>
                        <input type="checkbox" name="specialGift" <?php echo $specialGift ?> value="specialGift"/>
                        <span class="error"></span>
                        <div class="clear"></div>
                    </li>
                </ul>
            </div>
            
           
            <!--END Body-->
        </div>
        <div class="clear"></div>
    </div>
</div>
</form>
<div class="footer">
	<div class="content">
    	<div class="left">
        	<!--BEGIN: Footer Left-->
            <!--END Footer Left-->
        </div>
        <div class="right">
        	<!--BEGIN: Footer Right-->
            <!--END Footer Right-->
        </div>
        <div class="clear"></div>
    </div>
</div>
</body>
</html>